import requests
import json


def quest_run(query, conversation_id="5c8cd1f5-1438-4241-a0cc-0ac9067e24a7", file_ids=None):
    if file_ids is None:
        file_ids = []
    url = "https://qianfan.baidubce.com/v2/app/conversation/runs"
    
    payload = json.dumps({
        "app_id": "79f5f6e2-0e16-4e98-ba14-e2ef6341d343",
        "query": query,
        "stream": False,
        "conversation_id": conversation_id,
        "file_ids": file_ids,
    })
    headers = {
        'Content-Type': 'application/json',
        'X-Appbuilder-Authorization': 'Bearer bce-v3/ALTAK-Espg8KHYJBAQ94MfVHMQ4/3fe5583d4006d1519c96b8f817d49b27042003a6'
    }

    response = requests.request("POST", url, headers=headers, data=payload)

    # print(response.text)
    return response.json()

# if __name__ == '__main__':
#     quest_run()
